import typescript from '@typescript-eslint/eslint-plugin'
import typescriptParser from '@typescript-eslint/parser'
import vue from 'eslint-plugin-vue'
import prettier from 'eslint-plugin-prettier'

export default [
  {
    files: ['**/*.{js,jsx,mjs,cjs,ts,tsx,vue}'],
    env: {
      browser: true,
      es2021: true,
      node: true
    },
    plugins: {
      '@typescript-eslint': typescript,
      vue: vue,
      prettier: prettier
    },
    languageOptions: {
      parser: vue.parserServices,
      parserOptions: {
        ecmaVersion: 'latest',
        sourceType: 'module',
        parser: typescriptParser
      }
    },
    rules: {
      ...js.configs.recommended.rules,
      ...typescript.configs.recommended.rules,
      ...vue.configs.recommended.rules,
      'vue/multi-word-component-names': 'off',
      'prettier/prettier': 'error',
      'vue/no-v-html': 'off',
      '@typescript-eslint/no-explicit-any': 'warn',
      '@typescript-eslint/no-unused-vars': 'warn',
      'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
      'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
    }
  }
]